<?php


use App\Exceptions\ApiExceptions;
use App\Services\Jobposition\SignUpService;
use App\Services\Registration\RegistrationService;
use App\Services\Umeng\UmengService;
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log;

/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
Artisan::command('resetadmin', function () {
    $model = config('admin.database.users_model');
    $user = (new $model)->find(1);
    $user->username = 'admin';
    $user->password = bcrypt('qq123456');
    $user->save();
    dd('success');
})->describe('重置admin账号密码');
Artisan::command('inspire', function () {
    $this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');

Artisan::command('test', function () {

    RegistrationService::changeRegistrationNum(
        companyId: 2,
        changeNum: -1,
        operate_at: date('Y-m-d H:i:s'),
        remark: '报名消耗'
    );
    dd(333);
    $ser = new SignUpService();
    $res = $ser->getJobContact(26,3,2);
    dd($res->toArray());
    $res = '';

    dd($res);
    $res = '{"success":true,"data":{"mobile":"18192690392","score":null,"activeScore":null,"aesEncryptKey":null},"code":2001,"message":"gain mobile&#39;s result success","requestId":"D49DF67D-0FA1-4A4F-AB32-0BF3867BBE2D"}';
    $res = json_decode($res, true);
    if ($res['success']) {
        $mobile = $res['data']['mobile'] ?? '';
        if (!$mobile) {
            throw new ApiExceptions('获取手机号码失败2');
        }
    }
    dd($mobile);
    $token = 'eyJvIjoiaU9TIiwiayI6Imh6SnRHd0RPUGhTVmhqZncrOHpjd21iQjJkd3RWWFdwM1B1NFliS2VaSkNcL1hycXhuOXBpYndBWUp4ZHpKSVNCeGc2QTNEcFlvdWhuNGJvRThVeE91ZEFXT0p1NCtOWFBvMU1mRkFuOW13dlNKODJaTjgzeDlOQkpaZEwwbnc0cDEzcDl4QnRhMnhwSnk5b0c5XC9MQzJCNjFPTXRvUkZ2RWowSWlQWFVGQzNpU2VIcWdQTVpGdFhu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